using System;
using System.Collections.Generic;
using UnityEngine;

public class AdManagerOld
{
	public static bool ENABLE = true;

	public static int ADDMONEY_TYPE;

	public static int REVIVE_TYPE = 2;

	public static int INTERSECT_CUSTOM_EXIT = 1;

	public static int INTERSECT_CUSTOM_FIRST = 2;

	public static int INTERSECT_CUSTOM_STARTLEVEL = 3;

	public static int INTERSECT_CUSTOM_PAUSE = 4;

	public static int INTERSECT_CUSTOM_ENDLEVEL = 5;

	private static AdManagerOld _instace;

	private IAd _curAd;

	private float _startTime;

	private Action<int> _onCallback;

	private Action<int> _onIntersectCallback;

	private Dictionary<int, float> _mapIntesectTime = new Dictionary<int, float>();

	public static AdManagerOld instance
	{
		get
		{
			if (_instace == null)
			{
				_instace = new AdManagerOld();
			}
			return _instace;
		}
	}

	public IAd curAd
	{
		get
		{
			return _curAd;
		}
		set
		{
			_curAd = value;
		}
	}

	private AdManagerOld()
	{
		_curAd = new QiXunAd();
	}

	public void Init()
	{
		_startTime = Time.time;
		_curAd.Init();
	}

	public void InvokeVedioCallback(int customVal)
	{
		return;
		if (customVal == ADDMONEY_TYPE)
		{
		}
		if (_onCallback != null)
		{
			_onCallback(customVal);
		}
	}

	public void InvokeIntersectCallback(int customVal)
	{
		return;
		if (_onIntersectCallback != null)
		{
			_onIntersectCallback(customVal);
		}
		if (customVal == INTERSECT_CUSTOM_EXIT)
		{
			Application.Quit();
		}
	}

	public void PlayVideo(int customVal, Action<int> onFinish)
	{
		return;
		_onCallback = onFinish;
		_curAd.ShowVideo(customVal);
	}

	public void ShowInterstitial(string pageType, int customVal, Action<int> onClosed)
	{
		return;
		if (_mapIntesectTime.ContainsKey(customVal))
		{
			if (Time.time - _startTime > 240f)
			{
				if (Time.time - _mapIntesectTime[customVal] > 120f)
				{
					_onIntersectCallback = onClosed;
					_mapIntesectTime[customVal] = Time.time;
					_curAd.ShowInterstitial(pageType, 0, customVal);
				}
				else
				{
					onClosed?.Invoke(customVal);
				}
			}
			else if (Time.time - _mapIntesectTime[customVal] > 90f)
			{
				_onIntersectCallback = onClosed;
				_mapIntesectTime[customVal] = Time.time;
				_curAd.ShowInterstitial(pageType, 0, customVal);
			}
			else
			{
				onClosed?.Invoke(customVal);
			}
		}
		else
		{
			_onIntersectCallback = onClosed;
			_curAd.ShowInterstitial(pageType, 0, customVal);
		}
	}
}
